﻿#pragma once


#include <QDialog>
#include <QPushButton>
#include "QListView"
#include "QStringListModel"
#include "QFileDialog"
#include "QMessageBox"
#include "QApplication"
#include "QVBoxLayout"
#include <QDesktopWidget>
#include <QLibrary>
#include <QApplication>
#include <QLabel>
#include <QComboBox>
#include "QListView"
#include "QStringListModel"
#include "QLineEdit"
#include "QSpinBox"
#include "QRadioButton"
#include <QSettings>

#include "commonfunction.h"



using namespace std;

#include "qt_graphics_view.h"

#include "dl_3.h"






class FunctionDLLine9007 :public QDialog
{
public:


    QSettings* m_qsettings;
    QString m_section   = "";
    AIDll* m_dl=nullptr ;
	bool m_state = false;
     
    QtQGraphicsView* m_view ;

    QPushButton* m_pushbutton_open_model;
    QLabel     * m_qlabel_model_path;
    QString RetrainedModelFileName = "";

	QSpinBox * m_qspinbox_standard_size;
	int m_standard_size = 0;


	



	QSpinBox* m_qspinbox_height_min;
	int m_height_min = 0;

	QDoubleSpinBox * m_qspinbox_ratio;
	double m_ratio = 0;

    QPushButton* m_pushbutton_show_orign_image;
    QPushButton* m_pushbutton_detection;
    QPushButton* m_pushbutton_save_parameter;
    QPushButton* m_pushbutton_return;

    QLabel* m_qlabel_message;

    int m_result;

    
    int ret, message;

    int m_size_error_now;

    Mat m_image;
	vector<DefectResult> vector_result;
    Mat m_show_image;
    
	vector<DefectResult> vector_ng_result;
	

public:
    explicit FunctionDLLine9007(QDialog *parent = nullptr, QSettings* qsettings = nullptr,QString section="") ;
    ~FunctionDLLine9007() ;
    virtual void detectionImage();
    int detection(Mat image, QString& message);
	void draw(Mat image_in,Mat& image_out);
    virtual void loadParameter();
    virtual void saveParameter();
    virtual bool showDialog();
    void loadmodel();
	
};
#pragma execution_character_set("utf-8")
